#include<stdio.h>
#include<math.h>
int count=0;
int find(int n)
{
    int x;
	double sqrtn=sqrt(n);
    if(n==1)    return 0;
    if(n<=3)    return 1;
    if((n%6!=1)&&(n%6!=5))    return 0;
    for(x=5;x<=sqrtn;x+=6)
    {
        if(n%x==0||(n%(x+2)==0))
            return 0;
    }
    return 1;
}
int main()
{
    int t,a[1005],i,num,count;
    scanf("%d",&t);getchar();
    for(i=1;i<=t;i++)
    {
        count=0;
        scanf("%d",&a[i]);
        for(num=2;num<=a[i];num++)
            if(find(num))
            	count++;
        printf("%d\n",count);
    }
    return 0;
}
